<template>
  <div class="w-full">
    <BBAttention type="warning">
      {{ $t("two-factor.messages.2fa-required") }}
    </BBAttention>
    <div class="w-full p-2 sm:p-8 sm:px-16">
      <TwoFactorSetup :cancel-action="handleSetupCancel" />
    </div>
  </div>
</template>

<script lang="ts" setup>
import { useRouter } from "vue-router";
import { AUTH_SIGNIN_MODULE } from "@/router/auth";
import { useAuthStore } from "@/store";
import TwoFactorSetup from "./TwoFactorSetup.vue";
import { BBAttention } from "@/bbkit";

const router = useRouter();
const authStore = useAuthStore();

const handleSetupCancel = () => {
  authStore.logout().then(() => {
    router.push({ name: AUTH_SIGNIN_MODULE });
  });
};
</script>
